package com.xmall.bean.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 * @author Connor
 * @ClassName: BaseCouponRespVO
 * @PackageName: com.xmall.bean.vo
 * @date 2020/12/10
 * @Version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseCouponRespVO {

    /**
     * 优惠券领取状态码
     */
    Integer errno;

    /**
     * 优惠券领取情况说明
     */
    String errmsg;

    public static BaseCouponRespVO ok(String errmsg) {
        // 0:优惠券领取或者兑换成功
        return new BaseCouponRespVO(0, errmsg);
    }

    public static BaseCouponRespVO fail() {
        return new BaseCouponRespVO(500, "失败");
    }

    public static BaseCouponRespVO fail(String errmsg) {
        // 740:优惠券已领完，已领过或者优惠码已兑换过
        return new BaseCouponRespVO(740, errmsg);
    }

    public static BaseCouponRespVO errCode() {
        return new BaseCouponRespVO(742, "优惠码不正确！");
    }
}
